home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
FinderFlocks
/
Shell
/
init.cp
< prev
next >
Wrap
Text File
|
1996-06-22
|
3KB
|
128 lines
#include "Shell.h"
//#include "AfterDarkUtils.h"
extern WindowRecord Wind, CntlWind;
extern WindowPtr gWindPtr, gCntlWindPtr;
extern Boolean gDoneFlag;
extern Rect gDeskRect;
extern Boolean gCQDAvailable;
// The parameter block pieces
extern char errorStr[256];
extern struct QDGlobalsCopy qglobs;
extern struct
{
short monitorCount;
MonitorData monitorList[6];
}monInfo;
extern struct GMParamBlock gParamBlock;
void InitParamBlock(void);
/*-------------------------------------------------------------------------
initshell() Inits all the application-specific variables...
-------------------------------------------------------------------------*/
void initshell(void)
{
MenuHandle mhndl;
Rect temprect;
short err, cnt;
unsigned long seed;
/* Get Bounding box of Desktop */
gDeskRect = (**GetGrayRgn()).rgnBBox;
/* Reset random number generator */
GetDateTime(&seed);
qd.randSeed = seed;
/* Read in menus, draw the bar...
mhndl = GetMenu(APPLE_ID);
if(mhndl == nil)
{
SysBeep(10);
ExitToShell();
}
AddResMenu(mhndl, 'DRVR');
InsertMenu(mhndl, 0);
(*mhndl)->menuID = APPLE_ID;
mhndl = GetMenu(FILE_ID);
if(mhndl == nil)
{
SysBeep(10);
ExitToShell();
}
InsertMenu(mhndl, 0);
(*mhndl)->menuID = FILE_ID;
mhndl = GetMenu(EDIT_ID);
if(mhndl == nil)
{
SysBeep(10);
ExitToShell();
}
InsertMenu(mhndl, 0);
(*mhndl)->menuID = EDIT_ID;
DrawMenuBar(); */
// Set up the After Dark param block
InitParamBlock();
}
void InitParamBlock(void)
{
// put gParamBlock together
gParamBlock.monitors = (MonitorsInfoPtr)&monInfo;
gParamBlock.qdGlobalsCopy = &qglobs;
gParamBlock.errorMessage = (StringPtr)errorStr;
// Set up QDGlobals
qglobs.qdThePort = gWindPtr;
BlockMove(&qd.black, &(qglobs.qdBlack), sizeof(Pattern));
BlockMove(&qd.white, &(qglobs.qdWhite), sizeof(Pattern));
BlockMove(&qd.gray, &(qglobs.qdGray), sizeof(Pattern));
BlockMove(&qd.ltGray, &(qglobs.qdLtGray), sizeof(Pattern));
BlockMove(&qd.dkGray, &(qglobs.qdDkGray), sizeof(Pattern));
BlockMove(&qd.arrow, &(qglobs.qdArrow), sizeof(Cursor));
BlockMove(&qd.screenBits, &(qglobs.qdScreenBits), sizeof(BitMap));
qglobs.qdRandSeed = qd.randSeed;
gParamBlock.colorQDAvail = gCQDAvailable;
gParamBlock.systemConfig = 0;
// Set up Monitor Info
/* Check for ColorQD */
if(gCQDAvailable)
{
GDHandle gdh;
short numdevs = 0;
/* Get first device rect */
gdh = GetDeviceList();
if(gdh != 0L)
{
monInfo.monitorList[numdevs].bounds = (**gdh).gdRect;
monInfo.monitorList[numdevs].curDepth = (*((*gdh)->gdPMap))->pixelSize;
numdevs++;
/* Get the rest */
while(numdevs < 6)
{
gdh = GetNextDevice(gdh);
if(gdh == 0L)
break;
monInfo.monitorList[numdevs].bounds = (**gdh).gdRect;
monInfo.monitorList[numdevs].curDepth = (*((*gdh)->gdPMap))->pixelSize;
numdevs++;
}
monInfo.monitorCount = numdevs;
}
}
}